home *** CD-ROM | disk | FTP | other *** search
- Path: mongol.sasknet.sk.ca!news@mongol.sasknet.sk.ca
- From: darren.dzikowski@dlcwest.com (Darren Dzikowski)
- Newsgroups: comp.lang.c++
- Subject: BC++ 4.5 Problems with Dialogs
- Date: 24 Mar 1996 19:04:18 GMT
- Organization: SaskNet News Distribution
- Message-ID: <4j46bi$65l@mongol.sasknet.sk.ca>
- NNTP-Posting-Host: sabre19.sasknet.sk.ca
- Mime-Version: 1.0
- Content-Type: Text/Plain; charset=US-ASCII
- X-Newsreader: WinVN 0.99.7
-
- Hi there:
-
- 1. When I try to specify a dialog class with Borland's Resource Workshop,
- (ie. CLASS BorDLG_GRAY in a .RC file..(All I want to do is create a dialog
- with a gray background)) the dialog box will display when I compile my
- application and run it with Borland IDE running. However, if I exit the IDE
- and try to run my application, the dialog window will not open. Is there a
- header instruction I need to include to make this work properly?
-
- 2. Is there a quick and dirty way to change the background color of a dialog
- window? I would like it to be LT_GRAY...note problem 1... I have a book on
- this but it seemed pretty messy the way they explained it, which is something
- like these excerpts(P.S. I would like to know how to do it in both 16 and 32
- bit Windows versions:) Many thanks in advance!
-
- #ifdef WIN32
- case WM_CTLCOLORSTATIC:
- case WM_CTLCOLORBTN:
- case WM_CTLCOLOREDIT:
- return HANDLE_WM_CTLCOLORSTATIC(hDlg, wParam, lParam, Shape_OnCtlColor);
- case WM_CTLCOLORDLG:
- return HANDLE_WM_CTLCOLORDLG(hDlg, wParam, lParam, Shape_OnCtlColor);
- #else
- case WM_CTLCOLOR:
- return HANDLE_WM_CTLCOLOR(hDlg, wParam, lParam, Shape_OnCtlColor);
-
- #endif
- }
- return FALSE;
- }
-
-
- /////////////////////////////////////////////////////////
- // WM_CTLCOLOR
- /////////////////////////////////////////////////////////
- #pragma argsused
- HBRUSH Size_OnCtlColor(HWND hwnd, HDC hdc, HWND hwndChild, int type)
- {
- switch (type)
- {
- case CTLCOLOR_STATIC:
- SetTextColor(hdc, RGB(255, 0, 0));
- SetBkMode(hdc, TRANSPARENT);
- return GetStockBrush(BLACK_BRUSH);
-
- case CTLCOLOR_DLG:
- return GetStockBrush(BLACK_BRUSH);
- }
- return NULL;
- }
-
-
- /////////////////////////////////////////////////////////
- // WM_CTLCOLOR
- /////////////////////////////////////////////////////////
- #pragma argsused
- HBRUSH Shape_OnCtlColor(HWND hwnd, HDC hdc, HWND hwndChild, int type)
- {
- switch(type)
- {
- case CTLCOLOR_STATIC:
- case CTLCOLOR_EDIT:
- case CTLCOLOR_BTN:
- /* Set text to white and background to green */
- SetTextColor(hdc, RGB(0, 127, 0));
- SetBkMode(hdc, TRANSPARENT);
- return GreenBrush;
-
- case CTLCOLOR_DLG:
- return GreenBrush;
- }
- return NULL;
- }
-
- //-------------------------------------------------
- // SizeBoxProc Dialog
- //-------------------------------------------------
- #pragma argsused
- BOOL CALLBACK SizeBoxProc(HWND hDlg, WORD Msg,
- WORD wParam, LONG lParam)
- {
- TSIZEDATA SizeData;
- void *lpSizeData;
- char S[20];
- int i;
-
- int Indexs[] = {2100, 2200, 2300, 2400, 2500, 2600};
-
- switch(Msg)
- {
- case WM_CLOSE:
- DestroyWindow(hDlg);
- hSizeBox = 0;
- return TRUE;
-
- #ifdef WIN32
- case WM_CTLCOLORSTATIC:
- return HANDLE_WM_CTLCOLORSTATIC(hDlg, wParam, lParam, Size_OnCtlColor);
- case WM_CTLCOLORDLG:
- return HANDLE_WM_CTLCOLORDLG(hDlg, wParam, lParam, Size_OnCtlColor);
- #else
- case WM_CTLCOLOR:
- return HANDLE_WM_CTLCOLOR(hDlg, wParam, lParam, Size_OnCtlColor);
- #endif
-
-